package de.fhaugsburg.games.boardgames;

import de.fhaugsburg.games.boardgames.scrabble.scrabbleboard.IPiece;


public class Player {


	/**
	 * different types of players
	 */
	public static enum PlayerType{
		LOCAL, TERMINAL, CPU;
	}
	
	
	
	
	private String playerName;
	private Board<IPiece, Object> board;
	private PlayerState playerState;
	private int move;
	private int points;
	private int id;
	private PlayerType playerType;
	
	static int nextPlayerId = 0;
	
	
	
	
	
	/**
	 * Constructor
	 * @param name
	 * @param symbol
	 */
	public Player(String name, Board<IPiece, Object> board, PlayerType playerType){
		this.playerName = name;
		this.board = board;
		this.points = 0;
		this.setPlayerType(playerType);
		this.id = nextPlayerId++;	//(int) (Math.random() * 9999)
	}
	
	
	public Player(String name, Board<IPiece, Object> board){
		this (name, board, PlayerType.LOCAL);
	}
	
	
	
	
	public String getPlayerName(){
		return playerName;
	}
	
	public void setPlayerName(String name){
		this.playerName = name;
	}
	
	public Board<IPiece,Object> getBoard(){
		return this.board;
	}

	public void setPlayerState(PlayerState playerState) {
		this.playerState = playerState;
	}

	public PlayerState getPlayerState() {
		return playerState;
	}

	

	public void setMove(int move) {
		this.move = move;
	}


	public int getMove() {
		return move;
	}

	
	/**
	 * player gets credits
	 * @param credits
	 */
	public void addPoints(int points) {
		this.points += points;
	}

	public int getPoints() {
		return points;
	}
	
	
	/**
	 * returns the unique id for this player
	 * @return
	 */
	public int getId(){
		return this.id;
	}

	/**
	 * @param playerType the playerType to set
	 */
	private void setPlayerType(PlayerType playerType) {
		this.playerType = playerType;
	}

	/**
	 * @return the playerType
	 */
	public PlayerType getPlayerType() {
		return playerType;
	}


 }
